import 'package:app/shared/constants/common.dart';
import 'package:flutter/material.dart';

import 'mock.dart';

class AudioMessage extends StatelessWidget {
  final ChatMessage message;
  const AudioMessage({Key? key, required this.message}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 30,
      width: MediaQuery.of(context).size.width * 0.55,
      padding: EdgeInsets.symmetric(
          horizontal: sDefaultMarginPadding,
          vertical: sDefaultMarginPadding / 2),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(30),
          color: Colors.green.withOpacity(message.isSender ? 1 : 0.1)),
      child: Row(
        children: [
          Icon(
            Icons.play_arrow,
            color: message.isSender ? Colors.white : Colors.green,
          ),
          Expanded(
            child: Padding(
                padding: EdgeInsets.symmetric(horizontal: 12),
                child: Stack(
                  clipBehavior: Clip.none,
                  alignment: Alignment.center,
                  children: [
                    Container(
                      width: double.infinity,
                      height: 2,
                      color: message.isSender
                          ? Colors.white
                          : Colors.green.withOpacity(0.4),
                    ),
                    Positioned(
                        left: 0,
                        child: Container(
                          height: 8,
                          width: 8,
                          decoration: BoxDecoration(
                              color: message.isSender
                                  ? Colors.white
                                  : Colors.green.withOpacity(0.4),
                              shape: BoxShape.circle),
                        ))
                  ],
                )),
          ),
          Text(
            "0.37",
            style: TextStyle(
                fontSize: 12,
                color: message.isSender ? Colors.white : Colors.green),
          )
        ],
      ),
    );
  }
}
